package com.sky.blog.controller;

import com.sky.blog.dao.dto.PostsPageDTO;
import com.sky.blog.dao.vo.PostListVo;
import com.sky.blog.service.PostsService;
import com.sky.blog.vo.PageResult;
import com.sky.blog.vo.Results;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author sky  2022/3/23
 * @version 1.0
 */
@RestController
@RequestMapping("/blog/posts")
public class PostsController {

    @Resource
    private PostsService postsService;

    @PostMapping(value = "page")
    @ApiOperation(value = "分页查询")
    public Results paging(PostsPageDTO postsPageDTO) {
        System.out.println(postsPageDTO);
        PageResult<PostListVo> pageResult = postsService.selectListPage(postsPageDTO);
        return Results.SUCCESS.data(pageResult);
    }


}
